{extend name="mainadmin@layouts/base" /}
{block name="main" }
<header>
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="fa fa-ellipsis-v"></i>
                <strong>订单详情</strong>
            </li>
        </ul>

        <a class="pull-right pointer p-r" data-toggle="back" title="返回"><i class="fa fa-reply"></i></a>
    </div>
</header>

<section class="scrollable  wrapper ">
    <form class="form-horizontal form-validate" method="post" action="" style="padding:0;">
        <div class="alert alert-warning ">

            <div class="table-responsive">
                <table>
                    <tr>
                        <td>
                            当前订单状态：【{$orderInfo['ostatus']}】{$orderLang['os'][$orderInfo['order_status']]|raw},{$orderLang['ps'][$orderInfo['pay_status']]|raw},{$orderLang['ss'][$orderInfo['shipping_status']]|raw}
                        </td>

                        {notempty name="operating.confirmed"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('confirmed',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxCurl" class="btn btn-default btn-sm" data-msg="确定把订单设为确认？">确认订单</a>
                        </td>
                        {/notempty}
                        {notempty name="operating.recover"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('recover',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxCurl" class="btn btn-default btn-sm" data-msg="确定恢复已取消的订单？">恢复订单</a>
                        </td>
                        {/notempty}
                        {eq name="operating.isCancel" value="1"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('cancel',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxRemove" data-msg="确定取消订单？" class="btn btn-default btn-sm"
                               data-loading-text="取消中...">取消</a></td>
                        {/eq}
                        {notempty name="operating.setUnPay"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('setUnPay',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxRemove" data-msg="确定设为未付款？" class="btn btn-default btn-sm"
                               title="设为未付款">设为未付款</a></td>
                        {/notempty}
                        {notempty name="operating.returnPay"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('returnPay',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxRemove" data-msg="确定设为退款？" class="btn btn-default btn-sm"
                               title="设为退款">设为退款</a></td>
                        {/notempty}
                        {notempty name="operating.changePrice"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('changePrice',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxModal" class="btn btn-default btn-sm" title="修改价格">修改价格</a></td>
                        {/notempty}
                        {notempty name="operating.editConsignee"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('editConsignee',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxModal" class="btn btn-default btn-sm" title="修改收货信息">修改收货信息</a></td>
                        {/notempty}
                        {notempty name="operating.cfmCodPay"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('cfmCodPay',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxModal" class="btn btn-default btn-sm" title="线下支付收款确认">线下支付收款确认</a>
                        </td>
                        {/notempty}
                        {notempty name="operating.shipping"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('shipping',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxModal" class="btn btn-default btn-sm" title="发货">发货</a></td>
                        {/notempty}
                        {notempty name="operating.unshipping"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('unshipping',array('id'=>$orderInfo['order_id']))}"
                               data-toggle="ajaxCurl" data-msg="确定把订单设为未发货？" class="btn btn-default btn-sm"
                               title="未发货">设为未发货</a></td>
                        {/notempty}
                        {notempty name="operating.sign"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;" data-remote="{:url('sign',array('id'=>$orderInfo['order_id']))}"
                               data-msg="确定把订单设为签收？" data-toggle="ajaxCurl" class="btn btn-default btn-sm"
                               title="设为签收">设为签收</a></td>
                        {/notempty}
                        {notempty name="operating.unsign"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('unsign',array('id'=>$orderInfo['order_id']))}"
                               data-msg="确定把订单设为未签收？" data-toggle="ajaxCurl" class="btn btn-default btn-sm"
                               title="设为未签收">设为未签收</a></td>
                        {/notempty}
                        {notempty name="operating.returned"}
                        <td>&nbsp;</td>
                        <td><a href="javascript:;"
                               data-remote="{:url('returned',array('id'=>$orderInfo['order_id']))}"
                               data-msg="确定把订单设为退货状态？" data-toggle="ajaxCurl" class="btn btn-default btn-sm"
                               title="设为退货">设为退货</a></td>
                        {/notempty}

                    </tr>
                </table>
            </div>
        </div>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="col-sm-12">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">订单编号：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.order_sn}
                                {if condition="$orderInfo['order_type']!=2 && $orderInfo['pid'] > 0 "}
                                <a href="{:url('info',['order_id'=>$orderInfo['pid']])}" class="fr" target="_blank">查看主订单</a>
                                {/if}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">下单时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.add_time|dateTpl}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">支付时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.pay_time|dateTpl}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">确定时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.confirm_time|dateTpl}
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">购买用户：</label>
                            <div class="col-sm-5 form-control-static">
                                <a href="{:url('member/sys_admin.users/info',['user_id'=>$orderInfo['user_id']])}"  data-toggle="wrapperAjax">{$orderInfo.user_id} - {$orderInfo.user_id|userInfo}</a>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">买家留言：</label>
                            <div class="col-sm-8 form-control-static">
                                {$orderInfo.buyer_message}
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">发货时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.shipping_time|dateTpl}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">签收/自提时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.sign_time|dateTpl}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">退货时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.returned_time|dateTpl}
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">取消时间：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.cancel_time|dateTpl}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">佣金总额：</label>
                            <div class="col-sm-8 form-control-static">
                                {$orderInfo.dividend_amount|priceFormat=true}
                            </div>
                        </div>
                        {if condition="$orderInfo.give_integral > 0"}
                        <div class="form-group">
                            <label class="col-sm-3 control-label">赠送欢乐豆：</label>
                            <div class="col-sm-5 form-control-static">
                                {$orderInfo.give_integral} (订单签收后即返)
                            </div>
                        </div>
                        {/if}
                    </div>
                </div>
            </div>
            <header>
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tabinfo" data-toggle="tab">商品信息</a></li>
                    <li><a href="#payinfo" data-toggle="tab">支付信息</a></li>
                    <li><a href="#tabdescribe" data-toggle="tab">物流信息</a></li>
                    <li><a href="#tabdividend" data-toggle="tab">分佣信息</a></li>
                    {if condition="$orderInfo.is_after_sale > 0"}
                        <li><a href="#afterasle" data-toggle="tab">售后订单</a></li>
                    {/if}
                    <li><a href="#log" data-toggle="tab">订单日志</a></li>

                </ul>
            </header>
            <div class="panel-body">
                <div class="tab-content">
                    <div class="tab-pane active" id="tabinfo">

                        <div class="col-sm-12 table-responsive">

                            <table class="table table-bordered ">
                                <thead>
                                <tr>
                                    <th>商品信息</th>
                                    <th>单价</th>
                                    <th>数量</th>
                                    <th>小计</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="orderInfo.goodsList" id="grow"}
                                <tr>
                                    <td>

                                        <div class="media">
                                                        <span class="pull-left thumb-sm">
                                                            <img src="{$grow.pic}" alt="John said"></span>
                                            <div class="media-body">
                                                <div>{$grow.goods_name}</div>
                                                <div style="color:#999;">{$grow.sku_name}</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>{$grow.sale_price|priceFormat}</td>
                                    <td>{$grow.goods_number}</td>
                                    <td>{$grow['sale_price']*$grow['goods_number']|priceFormat}</td>
                                </tr>
                                {/volist}
                                <tr>
                                    <td colspan="4" align="right">
                                        <p>商品价格：{$orderInfo.goods_amount|priceFormat=true}</p>
                                        <p class="red">折扣：{$orderInfo.discount|priceFormat=true}</p>
                                        <p class="red">调整折扣：{:priceFormat($orderInfo.diy_discount* -1,true)}</p>
                                        {if condition="$orderInfo.use_bonus > 0"}
                                            <p class="red">优惠券：{$orderInfo.use_bonus|priceFormat=true}</p>
                                        {/if}
                                        {if condition="$orderInfo.use_integral > 0"}
                                            <p class="red">扣减欢乐豆：{$orderInfo.use_integral}</p>
                                        {/if}
                                        <p class="green">运费：{$orderInfo.shipping_fee|priceFormat=true}</p>
                                        <p>= 实收款：{$orderInfo.order_amount|priceFormat=true}</p>
                                    </td>
                                </tr>

                                </tbody>
                            </table>

                        </div>
                    </div>

                    <div class="tab-pane" id="payinfo">
                        <div class="col-sm-12">
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <div class="col-sm-10 ">
                                        应付款:{$orderInfo.order_amount|priceFormat=true} <span class="m-l-lg">已收款:{$orderInfo.money_paid|priceFormat=true}</span>
                                    </div>
                                </div>
                            </div>


                        </div>
                        <div class="col-sm-12 table-responsive">
                            {eq name="$orderInfo.is_pay" value="0"}
                            <table class="table table-bordered ">
                                <thead>
                                <tr>
                                    <th width="120">操作者</th>
                                    <th width="180">确认收款时间</th>
                                    <th width="120">支付金额</th>
                                    <th>备注</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>{$orderInfo.cfmpay_user}</td>
                                    <td>{$orderInfo.pay_time|dateTpl}</td>
                                    <td>{$orderInfo.money_paid|priceFormat}</td>
                                    <td>{$orderInfo.transaction_id}</td>
                                </tr>
                                </tbody>
                            </table>
                            {else/}
                            <table class="table table-bordered ">
                                <thead>
                                <tr>
                                    <th>支付方式</th>
                                    <th>支付金额</th>
                                    <th>支付时间</th>

                                    <th>支付流水号|商户订单号|线下打款凭证</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>{$orderInfo.pay_name}</td>
                                    <td>{$orderInfo.money_paid|priceFormat}</td>
                                    <td>{$orderInfo.pay_time|dateTpl}</td>

                                    <td class="image-list">
                                        {eq name="orderInfo.pay_code" value="offline"}
                                        {volist name="$orderInfo.offlineimg" id="img" }
                                            <img src="{$img}" style="width:50px;height: 50px;">
                                        {/volist}
                                        {else}
                                        {$orderInfo.transaction_id}
                                        {/eq}
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            {/eq}
                        </div>
                    </div>
                    <div class="tab-pane" id="tabdescribe" style="overflow: hidden">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">收货人：</label>
                            <div class="col-sm-8 form-control-static">
                                {$orderInfo.consignee}

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">联系手机：</label>
                            <div class="col-sm-8 form-control-static">
                                {$orderInfo.mobile}

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">收货地址：</label>
                            <div class="col-sm-8 form-control-static">
                                【{$orderInfo.merger_name}】
                                {$orderInfo.address}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">快递费用：</label>
                            <div class="col-sm-8 form-control-static">

                                {eq name="$orderInfo.shipping_fee" value="0"}
                                免运费
                                {else/}
                                {$orderInfo.shipping_fee|priceFormat=true}
                                {/eq}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">买家留言：</label>
                            <div class="col-sm-8 form-control-static">
                                {$orderInfo.buyer_message}
                            </div>
                        </div>
                        {gt name="$orderInfo.shipping_status" value="0"}
                        <div class="form-group">
                            <label class="col-sm-5 control-label">快递公司：</label>
                            <div class="col-sm-8 ">
                                <label>{$orderInfo.shipping_name} 快递单号：{$orderInfo.invoice_no}</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-5 control-label"></label>
                            <div class="col-sm-8 shipping_log">
                                <table class="table table-bordered ">
                                    <thead>
                                    <tr>
                                        <td colspan="4">数据加载中...</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table></div>
                        </div>
                        <script type="text/javascript">
                            $(function(){
                                var _obj = $('.shipping_log');
                                jq_ajax('{:url("shop/api.shipping/getLog")}','order_id={$orderInfo.order_id}',function(res){
                                    if (res.code == 0){
                                        _obj.find('thead td').html(res.msg);
                                        return false;
                                    }
                                    _obj.find('thead').remove();
                                    $.each(res.data.data,function(i,v){
                                        _obj.find('tbody').append('<tr><td>'+v.time+'</td><td >'+v.context+'</td></tr>');
                                    })
                                })
                            })
                        </script>
                        {/gt}
                    </div>
                    <div class="tab-pane" id="tabdividend">
                        <div class="form-group">
                            <div class="col-sm-12">

                                订单金额：{$orderInfo.order_amount|priceFormat=true} <span class="m-l-lg">佣金总额：{$orderInfo.dividend_amount+$orderInfo.buy_brokerage_amount|priceFormat=true}</span>

                                <span class="m-l-lg ">会员下单时身份：{$orderInfo.dividend_role_name}</span>
                                <!-- <a href="javascript:;"
                                   data-remote="{:url('upDividend',array('id'=>$orderInfo['order_id']))}"
                                   data-msg="确定重新计算分佣？" data-toggle="ajaxCurl" class="btn  btn-sm fr "
                                   title="重新计算分佣">重新计算分佣</a> -->


                            </div>
                        </div>
                        <div class="col-sm-12 table-responsive">
                            <table class="table table-bordered ">
                                <thead>
                                <tr>
                                    <th>用户ID</th>
                                    <th>分佣身份</th>
                                    <th>奖项相关</th>
                                    <th>佣金</th>
                                    <th>扶持基金</th>
                                    <th>分佣状态</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="dividend_log" id="dlog"}
                                <tr>
                                    <td><a href="{:url('member/sys_admin.users/info',['user_id'=>$dlog['dividend_uid']])}" data-toggle="wrapperAjax">{$dlog.dividend_uid}-{$dlog.dividend_uid|userInfo}</a></td>
                                    <td>{$dlog.role_name}</td>
                                    <td>{$dlog.award_name} - {$dlog.level_award_name}</td>
                                    <td>{$dlog.dividend_amount|priceFormat}</td>
                                    <td>{$dlog.dividend_bean|priceFormat}</td>
                                    <td>{$orderLang['ds'][$dlog['status']]}</td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>

                        </div>
                    </div>
                    <div class="tab-pane" id="log">
                        <table class="table table-bordered ">
                            <thead>
                            <tr>
                                <th width="150">记录时间</th>
                                <th width="120">操作者</th>
                                <th width="100">订单状态</th>
                                <th width="100">支付状态</th>
                                <th width="100">发货状态</th>
                                <th>备注</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="orderLog" id="log"}
                            <tr>
                                <td>{$log.log_time|dateTpl}</td>
                                <td>{$log.admin_id|adminInfo}</td>
                                <td>{$orderLang['os'][$log['order_status']]|raw}</td>
                                <td>{$orderLang['ps'][$log['pay_status']]|raw}</td>
                                <td>{$orderLang['ss'][$log['shipping_status']]|raw}</td>
                                <td>{$log.log_info}</td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>


        </section>

    </form>
</section>

{/block}

